<template>
  <h3>子组件</h3>
  <button @click="sendFuFN">向父组件传值</button>
  <button @click="$parent.getDatas('这是子组件给父组件传的值2')">
    向父组件传值2
  </button>
  {{ ZuDatas }}
  <div></div>
</template>

<script setup>
import { ref, defineEmits, inject, provide } from "vue";
const ZuDatas = inject("ZuDatas");
const emit = defineEmits(["getData"]);
function sendFuFN() {
  emit("getData", "这是子组件给父组件传的值1");
  // console.log(test);
  console.log(ZuDatas);
  // provide("sonDatas",'123456')
}
</script>
